package view.hall
{
	import core.Control;
	
	import flash.display.InteractiveObject;
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import flash.text.TextField;
	import flash.text.TextFieldType;
	
	import view.components.Input;
	import view.components.LabelButton;
	
	
	public class Search extends Sprite
	{
		private var input:Input;
		private var but:InteractiveObject;
		private var _control:Control = Control.getInstance();
		
		public function Search()
		{
			initInput();
			initBut();
			initBg();
			
		}
		
		
		
		private function initBg():void
		{
			with (this.graphics)
			{
				clear();
				lineStyle(2,0xE6882B);
				drawRoundRect(0,0,161,20,20,20);
				
			}
		}
		
		private function initBut():void
		{
			but = new LabelButton(input.x + input.width, 1,0,onBut,"face_search");
			addChild(but);
		}
		
		private function onBut(event:MouseEvent):void
		{
			_control.searchControl.searchRoom();
		}
		
		private function initInput():void
		{
			input = new Input(135,20,0xFFFFFF,false);
			input.type = TextFieldType.INPUT;
			input.textField.maxChars = 100;
			addChild(input);
			
		}
		
		public function get textField():TextField
		{
			return input.textField;
		}
		
	
	}
}